package com.yaya.spring.ioc.life;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/*注意:需要把这个类注册到spring的容器中,才能生效*/
public class MyBeanPostProcessor implements BeanPostProcessor{
	
	//bean对象初始化之前调用
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		System.out.println("第六步,调用postProcessBeforeInitialization方法,因为spring容器中注册了BeanPostProcessor接口的实现类");
		return bean;
	}
	
	//bean对象初始化之后调用
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		System.out.println("第八步,调用postProcessAfterInitialization方法,因为spring容器中注册了BeanPostProcessor接口的实现类");
		return bean;
	}

}
